function updateStartTime(date) {
  return `update tab_TestItemState set kssj = '${date}',sjsj=NULL,zpsj=NULL,jssj=NULL,gxsj=CONVERT(varchar,GETDATE(),120) WHERE jyxm ='${this.$store.state.carInfo.jyxm}'  and jylsh = '${this.$store.state.carInfo.jylsh}' and jycs=${this.$store.state.carInfo.jycs}`;
}

function updateDataTime() {
  return `update tab_TestItemState set sjsj= CONVERT(varchar,GETDATE(),120),gxsj=CONVERT(varchar,GETDATE(),120) WHERE jyxm ='${this.$store.state.carInfo.jyxm}'  and jylsh = '${this.$store.state.carInfo.jylsh}' and jycs=${this.$store.state.carInfo.jycs}`
}

function updateTakePhotoTime() {
  return `update tab_TestItemState set zpsj= CONVERT(varchar,GETDATE(),120),gxsj=CONVERT(varchar,GETDATE(),120) WHERE jyxm ='${this.$store.state.carInfo.jyxm}'  and jylsh = '${this.$store.state.carInfo.jylsh}' and jycs=${this.$store.state.carInfo.jycs}`
}

function updateStopItemTime(date) {
  return `update tab_TestItemState set jssj= '${date}',gxsj=CONVERT(varchar,GETDATE(),120) WHERE jyxm ='${this.$store.state.carInfo.jyxm}'  and jylsh = '${this.$store.state.carInfo.jylsh}' and jycs=${this.$store.state.carInfo.jycs}`
}

function getAllTimeInStateTable() {
  return `select kssj,jssj,sjsj,zpsj from tab_TestItemState WHERE jyxm ='${this.$store.state.carInfo.jyxm}'  and jylsh = '${this.$store.state.carInfo.jylsh}' and jycs=${this.$store.state.carInfo.jycs}`
}

function getCarSizeInCarSizeTable() {
  let carInfo = this.$store.state.carInfo;
  return `select cwkc,cwkk,cwkg FROM tab_CarSize WHERE jycs=${carInfo.jycs} and jylsh='${carInfo.jylsh}'`
}

function getLoginInfo() {
  let carInfo = this.$store.state.carInfo;
  let sql = `SELECT zbzl as bzzczbzl,wbzl FROM tab_loginInfo WHERE jylsh='${carInfo.jylsh}' and hphm='${carInfo.hphm}' and jycs=${carInfo.jycs}`;
  return sql;
}

function updateExtDataInItemStatusTable(data) {
  let carInfo = this.$store.state.carInfo;
  return `update tab_TestItemState set extData='${data.extData}' WHERE jylsh='${carInfo.jylsh}' and hphm='${carInfo.hphm}' and jycs=${carInfo.jycs} and jyxm='${carInfo.jyxm}'`;
}

function getExtDataInItemStatusTable() {
  let carInfo = this.$store.state.carInfo;
  return `select extData from tab_TestItemState WHERE jylsh='${carInfo.jylsh}' and hphm='${carInfo.hphm}' and jyxm='${carInfo.jyxm}' and jycs=${carInfo.jycs}`;
}

function getCarSizeDataHasSend() {
  let carInfo = this.$getBase();
  return `select top 1 a1.cwkc,a1.cwkk,a1.cwkg,a2.cwkc cl_cwkc,a2.cwkk cl_cwkk,a2.cwkg cl_cwkg,a2.clwkccpd,a2.cwkcpd,a2.cwkkpd,a2.cwkgpd,a2.cwkcrgfc hand_cwkc,a2.cwkkrgfc hand_cwkk,a2.cwkgrgfc hand_cwkg  from tab_loginInfo a1 RIGHT JOIN tab_CarSize a2 on a1.jylsh = a2.jylsh where a2.jylsh='${carInfo.jylsh}' and a2.jycs=${carInfo.jycs}`;
}

function getCurbDataOfHasSend() {
  let carInfo = this.$getBase();
  return `SELECT top 1 a1.zbzl,a2.zbzl cl_zbzl,a2.zbzlpd FROM tab_loginInfo a1 RIGHT JOIN tab_CarSize a2 on a1.jylsh = a2.jylsh where a2.jylsh='${carInfo.jylsh}' and a2.jycs=${carInfo.jycs}`;
}

export default {
  updateStartTime,
  updateDataTime,
  updateTakePhotoTime,
  updateStopItemTime,
  getAllTimeInStateTable,
  getCarSizeInCarSizeTable,
  getLoginInfo,
  getExtDataInItemStatusTable,
  updateExtDataInItemStatusTable,
  getCarSizeDataHasSend,
  getCurbDataOfHasSend
}
